﻿<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>QQ消息管理器</title>
<style type="text/css">
/* scroll */
::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-button{ width:0; height:0; }
::-webkit-scrollbar-button:start:decrement,::-webkit-scrollbar-button:end:increment{ display:block; }
::-webkit-scrollbar-button:vertical:start:increment,::-webkit-scrollbar-button:vertical:end:decrement { display:none; }
::-webkit-scrollbar-corner{ display:block; }

::-webkit-scrollbar-thumb{
	background-clip:padding-box;
	background-color:rgba(0,0,0,.2);
	border-radius:8px;
}
::-webkit-scrollbar-thumb:hover{
	background-clip:padding-box;
	background-color:rgba(0,0,0,.5);
	border-radius:8px;
}
::-webkit-scrollbar-track:vertical,::-webkit-scrollbar-thumb:vertical{
	border-left:1px solid transparent;
	border-right:1px solid transparent;
}
::-webkit-scrollbar-track:horizontal,::-webkit-scrollbar-thumb:horizontal{
	border-top:1px solid transparent;
	border-bottom:1px solid transparent;
}
::-webkit-scrollbar-track:hover{
	background-clip:padding-box;
	background-color:rgba(0,0,0,.15);
}

::-webkit-scrollbar-button:vertical:start{width:10px;height:10px;background:url(qq:///txfile/systheme:ScrollBar/scrollbar_arrow.png) no-repeat 0 0}
::-webkit-scrollbar-button:vertical:start:hover{background:url(qq:///txfile/systheme:ScrollBar/scrollbar_arrow.png) no-repeat -15px 0}
::-webkit-scrollbar-button:vertical:start:active{background:url(qq:///txfile/systheme:ScrollBar/scrollbar_arrow.png) no-repeat -30px 0}
::-webkit-scrollbar-button:vertical:end{width:10px;height:10px;background:url(qq:///txfile/systheme:ScrollBar/scrollbar_arrow.png) no-repeat 0 -18px}
::-webkit-scrollbar-button:vertical:end:hover{background:url(qq:///txfile/systheme:ScrollBar/scrollbar_arrow.png) no-repeat -15px -18px}
::-webkit-scrollbar-button:vertical:end:active{background:url(qq:///txfile/systheme:ScrollBar/scrollbar_arrow.png) no-repeat -30px -18px}
/ scroll */
</style>
<script language="javascript">

var last;
var lastkeysel;
var iever = 5;
var g_itemcount = 0;
var clr_selbackground ;
var clr_borderclr1;
var clr_borderclr2;
var clr_selborder;
var multiselidlist = "";
var g_notify = true;
var g_gotoBottom = false;

function OnThemeColorChange()
{		 
     clr_selbackground = external.GetColor("#ffedc4");
     clr_borderclr1      = external.GetColor("#FAFBFB");
     clr_borderclr2      = external.GetColor("#F5F8FA");
     clr_selborder =   external.GetColor("#ffdb8d");

   try
   {
       with(document.body.style)
       { 
        scrollbar3dLightColor=external.GetColor("#BAC7DB") ;
        scrollbarArrowColor=external.GetColor("#81B0D4"); 
        scrollbarDarkShadowColor=external.GetColor("#FFFFFF") ;
        scrollbarFaceColor=external.GetColor("#F5F8FC") ;
        scrollbarHighlightColor=external.GetColor("#FFFFFF" );
        scrollbarShadowColor=external.GetColor("#BAC7DB") ;
        scrollbarTrackColor=external.GetColor("#F4F7FA" );
     } 
       if (iever > 5)
        {
    	    if (ItemTable.rows.length > 0)
   	   {
   		for(i=0;i<ItemTable.rows.length;i++)
    		{
			if (last == ItemTable.rows[i])
            			 {
                			ItemTable.rows[i].style.backgroundColor=clr_selbackground;
				            if (ItemTable.rows[i].cells.length >0)
				            {
				                ItemTable.rows[i].cells[0].style.cssText="border:1px "+clr_selborder+" solid;";
				            }
             			}
			else
          	{
          		    var bkIndex = ItemTable.rows[i].bkIndex;
          		     var bdclr = clr_borderclr1;
                        if (bkIndex == 2) 
                        {
	                        bdclr = clr_borderclr2;
    	                }
	   			        ItemTable.rows[i].style.backgroundColor=bdclr;
	   			        ItemTable.rows[i].style.borderColor=bdclr;
				        if (ItemTable.rows[i].cells.length >0){ItemTable.rows[i].cells[0].style.cssText="border:1px "+bdclr+" solid;";}
               }
		}
	}
    }
   }catch(e){}
}

function GetRealRow(rowObj)
{
   if(rowObj != null)
   {
     return rowObj.rowIndex;
     }
   
   return 0;
}

function OnClickImage(bsError, dwMsgIndex, dwElemIndex, dwRowId, image)
{
	if (image)
	{
		var left = image.getBoundingClientRect().left;
		var top = image.getBoundingClientRect().top;
		var right = image.getBoundingClientRect().right;
		var bottom = image.getBoundingClientRect().bottom;

		external.ClickImage(bsError, dwMsgIndex, dwElemIndex, dwRowId, left, top, right, bottom);
		return;
	}
	
	external.ClickImage(bsError, dwMsgIndex, dwElemIndex, dwRowId);	
}

function OnRClickImage(bsError, dwMsgIndex, dwElemIndex, dwRowId)
{
    external.RClickImage(bsError, dwMsgIndex, dwElemIndex, dwRowId);    
}

function OnClickReply(bsType, bsKey)
{
	external.OnClickReply(bsType, bsKey);
}

function OnDisposeItem(rowObj)
{
var index = GetRealRow(rowObj)
   external.OnDisposeItem(index);
}

function OnDbClickItem(rowObj)
{
   var index = GetRealRow(rowObj)
   external.ClickItem(index);
}
/*
function OnMouseTrackIn(rowObj)
{
    if (rowObj.all.tn.all.tv != null)
    {
        rowObj.all.tn.all.tv.style.visibility='visible';
    }
    if (rowObj.all.tn.all.tv_reply != null)
    {
        rowObj.all.tn.all.tv_reply.style.visibility='visible';
    }
}

function OnMouseTrackOut(rowObj)
{
  if (rowObj.all.tn.all.tv != null)
  {
     rowObj.all.tn.all.tv.style.visibility='hidden';
  }
  if (rowObj.all.tn.all.tv_reply != null)
  {
    rowObj.all.tn.all.tv_reply.style.visibility='hidden';
  }
}*/
function OnMouseTrackIn(rowObj)
{
	var childs = rowObj.childNodes;
	for (var i = 0; i < childs.length; i++)
	{
		if (childs[i].getAttribute("id") == 'tn')
		{
			var grandchilds = childs[i].childNodes;
			for (var j = 0; j < grandchilds.length; j++)
			{
				var reply = grandchilds[j];
				if (reply == null)
				{
					continue;
				}

				if (reply.getAttribute("id") == 'tv_reply')
				{
					reply.style.visibility='visible';
				}
				else if (reply.getAttribute("id") == 'tv')
				{
					reply.style.visibility='visible';
				}		
			}
			if (childs[i].firstChild != null)
			{
				var reply = childs[i].firstChild.firstChild;
				if (reply == null)
				{
					continue;
				}

				if (reply.getAttribute("id") == 'tv_reply')
				{
					reply.style.visibility='visible';
				}
				else if (reply.getAttribute("id") == 'tv')
				{
					reply.style.visibility='visible';
				}
			}
		}
	}
}

function OnMouseTrackOut(rowObj)
{
	var childs = rowObj.childNodes;
	for (var i = 0; i < childs.length; i++)
	{
		if (childs[i].getAttribute("id") == 'tn')
		{
			var grandchilds = childs[i].childNodes;
			for (var j = 0; j < grandchilds.length; j++)
			{
				var reply = grandchilds[j];
				if (reply == null)
				{
					continue;
				}

				if (reply.getAttribute("id") == 'tv_reply')
				{
					reply.style.visibility='hidden';
				}
				else if (reply.getAttribute("id") == 'tv')
				{
					reply.style.visibility='hidden';
				}		
			}
			if (childs[i].firstChild != null)
			{
				var reply = childs[i].firstChild.firstChild;
				if (reply == null)
				{
					continue;
				}

				if (reply.getAttribute("id") == 'tv_reply')
				{
					reply.style.visibility='hidden';
				}
				else if (reply.getAttribute("id") == 'tv')
				{
					reply.style.visibility='hidden';
				}
			}
		}
	}
}

function AddToMultiSel(rowObj,bCheck)
{   
    if (!bCheck)
    {
      SetSelStyle(rowObj);
      multiselidlist += GetRealRow(rowObj);
      multiselidlist += ",";
    }
    else
    {
       var id = GetRealRow(rowObj);
       if (multiselidlist!="")
       {
            var bfind = false;
            var   d = new   Array();   
             d = multiselidlist.split(",");   
             multiselidlist="";
             for   (var   i=0;i<d.length;i++)   
             {   
                 var m = d[i];
                 if (m!="")
                 {
                     if ( m==id )
                     {
                        bfind = true;
                     }
                     else
                     {
                        multiselidlist += m;
                        multiselidlist += ",";
                     }
                 };
             }
           
             if (!bfind)
             {
                 multiselidlist += id;
                 multiselidlist += ",";
                  SetSelStyle(rowObj);
             }
             else
             {
                var item = document.getElementById("itemId_"+id);

                ResetStyle(item);
             }
       }
       else
       {
            var rowlast = GetRealRow(last);
            if (rowlast!=id)
            {
                 multiselidlist += rowlast;
                 multiselidlist += ",";
            };
            
            multiselidlist += id;
            multiselidlist += ",";
             SetSelStyle(rowObj);
       }
    }
      
}

function ClearMultiSel()
{
      multiselidlist = "";
}

function ResetMultiSel()
{
     if (multiselidlist == "") return;
     var   d = new   Array();   
     d = multiselidlist.split(",");   
     for   (var   i=0;i<d.length;i++)   
     {   
         m=d[i];    

         var item=document.getElementById("itemId_"+ m);
        
         ResetStyle(item);
     }

      multiselidlist = "";
}

function ResetStyle(rowObj)
{
    if (rowObj==null) return;

   /* var bkIndex = rowObj.bkIndex;
    var bdclr = clr_borderclr1;
	if (bkIndex == 2) 
	{
		bdclr = clr_borderclr2;
	}*/
	
	rowObj.style.backgroundColor=null;
	rowObj.style.borderColor=null;
	
	//if (rowObj.cells.length >0){rowObj.cells[0].style.cssText="border:1px "+bdclr+" solid;";}
	if (rowObj.cells.length >0){rowObj.cells[0].style.cssText="border:1px solid transparent;";}
}

function SetSelStyle(rowObj)
{
    if (rowObj==null) return;
    
     rowObj.style.backgroundColor= clr_selbackground ;

    /*if (iever > 5)
    {
       if (rowObj.cells.length > 0)
       {
          rowObj.cells[0].style.cssText="border:1px "+clr_selborder+" solid;";
       }
    }*/
	if (rowObj.cells.length > 0)
	{
		rowObj.cells[0].style.cssText="border:1px "+clr_selborder+" solid;";
	}
};

function GetMultiSel()
{
      return multiselidlist;
}

function OnClickItem(rowObj)
{
    lastkeysel = rowObj;
    var bMultiSel = false;
    if ( external.EnableMultiSel() && (last !=null) && ( external.GetKeyState(17) < 0 || external.GetKeyState(16)<0))
    {
         bMultiSel = true;
         
         if (external.GetKeyState(16)<0) ///shift
         {
	        ResetMultiSel();
              var row1 = GetRealRow(rowObj);
              var row2 = GetRealRow(last);
              if (row1 < row2)
	            {
	                for(i=row1;i<=row2;i++)
	                {
	                    var item = document.getElementById("itemId_"+i);
                         AddToMultiSel(item,false);
	                }
	            }
                 else
	            {
	                for(i=row2;i<=row1;i++)
	                {
	                     var item = document.getElementById("itemId_"+i);
                         AddToMultiSel(item,false);
	                }
	            }
         }
        else
        {
              AddToMultiSel(rowObj,true);  //ctrl
        }
    }
    else
   {
      ResetMultiSel();
      ResetStyle(last);
      SetSelStyle(rowObj);
   }

   
    if (!bMultiSel )
    {
       last = rowObj;
       if (g_notify)
       {
			external.SetCurSel(GetRealRow(last));
       }
    }
	else
	{
	    if (g_notify)
        {
            external.SetMultiCurSel(GetMsgIndex(rowObj));
        }  
	}
}

function GetCurSel()
{
  if (last!=null )
  {
     return GetRealRow(last);
  }
  else
  {
	 return -1;
  }
}

function DeleteCurRow()
{
   if (last!=null )
  {
     ItemTable.deleteRow(last.rowIndex);
     last = null;
  }
}

function DeleteRow(msgid)
{
  var item=document.getElementById("itemId_"+msgid);
  if (item)
  {
    ItemTable.deleteRow(item.rowIndex);
  }
}

function SetCurSelIndex(msgid)
{
    var item=document.getElementById("itemId_"+msgid);
    if (item != null && msgid >= 0)
    {  
        OnClickItem(item);
    }
}

function SelectMsgFromMonthCal(msgid)
{
  g_notify = false;
  try
  {
    //SetCurSelIndex(msgid)
    var item=document.getElementById("itemId_"+msgid);
    var dateHeight = 26;    //显示消息记录上面的日期
    var top = item.offsetTop - dateHeight;
    if (top < 0)
    {
        top = 0;
    }
    if (top < document.body.scrollTop)
    { 
      document.body.scrollTop = top;
    }
    else if ((item.offsetTop + item.clientHeight) > (document.body.clientHeight+document.body.scrollTop))
    {
      document.body.scrollTop =( item.offsetTop + item.clientHeight - document.body.clientHeight);
    }
  }
  catch(e){}
  g_notify = true;
}

function SelectMsg(msgid,bsel)
{
  g_notify = true;
  try
  {
    var item=document.getElementById("itemId_"+msgid);
    if (bsel)
    {
       OnClickItem(item)
    }
 
    var top = item.offsetTop;
    if (msgid == 0)
    {   //选第0条要显示最顶
        top = 0;
    }

    if (top< document.body.scrollTop)
    { 
      document.body.scrollTop = top;
    }
    else if ((item.offsetTop + item.clientHeight) > (document.body.clientHeight+document.body.scrollTop))
    {
      document.body.scrollTop =( item.offsetTop + item.clientHeight - document.body.clientHeight);
    }
  }
  catch(e){}
  g_notify = true;
}

function ScrollToBottom()
{
 g_itemcount = external.GetCount();
 if (g_itemcount > 0)
 {
     scrollTo(0,document.body.scrollHeight);
     //SelectMsg(g_itemcount-1,false);
 }
//   scrollTo(0,document.body.scrollHeight);
}

function ScrollToPosition() 
{
    //document.body.style.overflow.x == 'hidden'
    if(true)
    {
        if(g_gotoBottom == true)
        {
            scrollTo(0,document.body.scrollHeight+20);
        }
    }
}

function ScrollToTop()
{
    scrollTo(0,0);
     //SelectMsg(0,false);
}

function CreateFrames()
{
    if (document.all.oleFrame!=null)
    {
        if (document.all.oleFrame.length!=null)
        {
             for (i=0;i<document.all.oleFrame.length;i++)
            {
				var npframe = document.all.oleFrame[i];
                external.OnCreateFrame(npframe.getAttribute("nodetype"),npframe.getAttribute("key"),parseInt(npframe.getAttribute("mid")),parseInt(npframe.getAttribute("im")),npframe.frame);
			}
        }
        else
        {
			var npframe = document.all.oleFrame;
            external.OnCreateFrame(npframe.getAttribute("nodetype"),npframe.getAttribute("key"),parseInt(npframe.getAttribute("mid")),parseInt(npframe.getAttribute("im")),npframe.frame);
		};
    }
}

function LoadMsgInfo()
{
    var Curpage=document.getElementById("Curpage");
   
    var head = "<table id='ItemTable'  width=100% cellspacing=0  style='word-wrap:break-word;word-break:break-all;'>";
    var foot = "</table>";
    var nitem = external.GetCount();
    external.BeginLoadMsg();

    var ShowmsgHtml = "";
    var bdclr = clr_borderclr1;
    var lastdate = "";
    var i = 0;
    var bbackchange = true;
 
    var strDate = external.loadstring("MSGMGR_DATE");
    g_itemcount = nitem;
    for (i=0; i < nitem; i++)
    {  
		try
		{  
			var hasmsg = external.GetAt(i);
			if (hasmsg == true)
			{
				//var msgobj = external.GetAt(i);
				//var sender = msgobj.sender;
				//var recver = msgobj.recver;
				//var msgtext = msgobj.html;
				//var date   = msgobj.date;
				//var time  = msgobj.time;
				//var bself = msgobj.bself;
				//var bshowhead = msgobj.bshowhead;

				var sender = external.GetAt(i,"sender");
				var recver = external.GetAt(i,"recver");
				var msgtext = external.GetAt(i,"html");
				var date   = external.GetAt(i,"date");
				var time  = external.GetAt(i,"time");
				var bself = external.GetAt(i,"bself");
				var bshowhead = external.GetAt(i,"bshowhead");;
				
				//---- date head----
				if(date != lastdate)
				{
					bbackchange =  !bbackchange;
					lastdate = date;
					var bkIndex = 1;

					if (bbackchange == true)
					{
					  bdclr = clr_borderclr1;
					  bkIndex = 1;
					}
					else
					{
						bdclr = clr_borderclr2;
						bkIndex = 2;
					}
				}

				var hdclr = "";
				if (bself)
					hdclr = "#42B475";
				else
					hdclr = "#006EFE";

				ShowmsgHtml += "<tr bkIndex="+bkIndex+" style=bgcolor="+bdclr+" id=itemId_"+i+" onclick=OnClickItem(this) ondblclick ='OnDbClickItem(this)' dCount=0><td><div style=color:"+hdclr+";padding-left:10px;>";
				if (bshowhead)
				{
					ShowmsgHtml += "<div style=float:left;margin-right:6px;>"+sender+"</div>"+time+"</div>";
					ShowmsgHtml +=  "<div class=msgContentDiv>"+msgtext+"</div></td></tr>"; 
				}
				else
				{
					ShowmsgHtml +=  "<div style=float:top;margin-top:5px;padding-left:0px;>"+msgtext+"</div></td></tr>"; 
				}
			}
		}
		catch(e)
		{
			ShowmsgHtml += "<tr><td></td></tr>";
		}		
    }

    ClearMultiSel();
    Curpage.innerHTML = head +ShowmsgHtml + foot;   
    
    g_gotoBottom = true;
    external.EndLoadMsg();
    CreateFrames();
}
function SelFirstItem()
{
   var row = 0;
   SelectMsg(row,true);
   lastkeysel = document.getElementById("itemId_"+row);
}
function SelLastItem()
{
   var row = external.GetCount();
   row = row - 1;
   SelectMsg(row,true);
   lastkeysel = document.getElementById("itemId_"+row);
   //scrollTo(0,document.body.scrollHeight + 20);
}

function InsertRow(index)
{
    var itemTable = document.getElementById("ItemTable");
     
    var nRowCount = itemTable.rows.length;
        
    var DefaultIndex = 888;
    if (index == DefaultIndex)
    {
    	index = nRowCount;
    }
    
    for (i=index; i<nRowCount; i++)
    {
        var Row = itemTable.rows(i);
        if (Row)
        {
            var j = i+1;
            Row.id = "itemId_" + j;
        }
    }
    
    var bkIndex = 2;  
    var hdclr = "";
     
    var hasmsg = external.GetInsertMsg();
	if (hasmsg == true)
	{
		var sender = external.GetInsertMsg("sender");
		var recver = external.GetInsertMsg("recver");
		var msgtext = external.GetInsertMsg("html");
		var date   = external.GetInsertMsg("date");
		var time  = external.GetInsertMsg("time");
		var bself = external.GetInsertMsg("bself");
		var bshowhead = external.GetInsertMsg("bshowhead");
	 
	    if (bself)
	    {
	        hdclr = "#42B475";
	    }
	    else
	    {
	        hdclr = "#006EFE";
	    }
	    
		var InsertIndex = index;
		if (index == nRowCount)
		{
			InsertIndex = -1;
		}
		var newRow = itemTable.insertRow(InsertIndex);
		
		newRow.bkIndex = bkIndex;
		newRow.style.borderColor = null;//clr_borderclr1;
		newRow.bgcolor = null;// = clr_borderclr1;       
		newRow.id = "itemId_" + index;
		newRow.onclick = function(){OnClickItem(this)};
		newRow.ondblclick = function(){OnDbClickItem(this)};
		newRow.dCount = 0;
		
		
		var newTd = newRow.insertCell();
		//newTd.style.borderColor = clr_borderclr1;
		var strTd = "<div style=color:"+hdclr+";padding-left:10px;>"+"<div style=float:left;margin-right:6px;>"+sender+"</div>"+time+"</div>"+"<div class=msgContentDiv>"+msgtext+"</div></td></tr>";
		newTd.innerHTML = strTd;
		
		
		var nRowCount = itemTable.rows.length;
		var nMaxCount = external.GetPageMaxCount();
		if (nRowCount > nMaxCount)
		{
			for (i=nMaxCount; i<nRowCount; i++)
			{
				var Row = itemTable.rows(i);
				Row.removeNode(true);
			}
		}
	}
}

function RespondKeyDown(keyCode) {
  if(keyCode == 38)
  {
       if (lastkeysel == null)
             {
                lastkeysel = last;
             }
           // event.returnValue=false;
             var rowlast = GetRealRow(lastkeysel);
             //alert(rowlast);
             if (rowlast > 0)
             {
                rowlast --;
                SelectMsg(rowlast,true);
                lastkeysel = document.getElementById("itemId_"+rowlast);
                 external.OnSelcetChange()

             }
             else
             {  // event.returnValue=true;
                 external.NotifyChangePage(1);
                 ScrollToBottom();
                
             };
  }
  else if(keyCode == 40)
  {
      if (lastkeysel == null)
             {
                lastkeysel = last;
             }
          //  event.returnValue=false;
             var rowlast = GetRealRow(lastkeysel);
             //alert(rowlast);
             g_itemcount = external.GetCount();

             if (rowlast < g_itemcount-1)
             {
                rowlast ++;
                SelectMsg(rowlast,true);
                 lastkeysel = document.getElementById("itemId_"+rowlast);
                  external.OnSelcetChange()
             }
             else
             {  
                 //event.returnValue=true;
                 external.NotifyChangePage(0);
                 ScrollToTop();
                
             };
  }
   else if (keyCode == 36)///Home
          {
           
              if(lastkeysel != null)
             {
            
                 SelectMsg(0,true);
                 lastkeysel = document.getElementById("itemId_"+0);
             };
          }
           else if (keyCode == 35)///End
          {
       
             if(lastkeysel != null)
             {
                 g_itemcount = external.GetCount();
                 SelectMsg(g_itemcount-1,true);
                 lastkeysel = document.getElementById("itemId_"+(g_itemcount-1));
             };
          }
    else if(keyCode == 33)  ///pageUp
    {
    
       ScrollToTop();
    }
    else if(keyCode == 34)  ///pageDown
    {
       ScrollToBottom();
    }
  

}

function OnCreateCSS(filename)
{
    // filename si an external css file
	var style = document.createElement("link");
	style.rel = "stylesheet";
	style.type = "text/css";	
	style.href = filename;
	
	document.getElementsByTagName("head")[0].appendChild(style);
}

function ImageZoom(image)
{
	var parent = image.parentNode;
	if (parent) 
	{
		var span = parent.lastChild;
		if (span) span.style.display='block';
	}
}
</script>

</head>
<body>
    <div class=pageDiv id="ThePage">
        <div class=pageDiv id="Curpage">
        </div>
    </div>

    <script language="javascript">
	iever = external.GetIEVer();
	OnThemeColorChange();
    </script>
    <script>
        document.onselectstart=function()
        {
           if (external.GetKeyState(17) < 0 || external.GetKeyState(16)<0)
           {
             event.returnValue=false;
           }
           else
           {
             event.returnValue=true;
           };
        }
        document.onkeydown=function()
        {
         //external.SetCurSel(-1);
         /*
         if (window.event.keyCode == 38)///up
          {
             if (lastkeysel == null)
             {
                lastkeysel = last;
             }
            event.returnValue=false;
             var rowlast = GetRealRow(lastkeysel);
             //alert(rowlast);
             if (rowlast > 0)
             {
                rowlast --;
                SelectMsg(rowlast,true);
                lastkeysel = document.getElementById("itemId_"+rowlast);
             }
             else
             {  // event.returnValue=true;
                 external.NotifyChangePage(1);
                
             };
          }
          else if (window.event.keyCode == 40) //down
          {
           if (lastkeysel == null)
             {
                lastkeysel = last;
             }
            event.returnValue=false;
             var rowlast = GetRealRow(lastkeysel);
             g_itemcount = external.GetCount();

             if (rowlast < g_itemcount-1)
             {
                rowlast ++;
                SelectMsg(rowlast,true);
                 lastkeysel = document.getElementById("itemId_"+rowlast);
             }
             else
             {  
                 //event.returnValue=true;
                 external.NotifyChangePage(0);
                
             };
          }
         else */
         if ( window.event.keyCode==116) 
        { 
                event.keyCode = 0; 
                event.cancelBubble = true; 
                event.returnValue=false;
        }

//          else if (window.event.keyCode == 46)///delete
//          {
//             if (lastkeysel == null)
//             {
//                lastkeysel = last;
//             }
//            event.returnValue=false;
//             var rowlast = GetRealRow(lastkeysel);
//             //alert(rowlast);
//             if (rowlast > 0)
//             {
//                DeleteRow(rowlast);
//             }
//             else
//             {
//                 event.returnValue=true;
//             };
//          }
           else if (window.event.keyCode == 36)///Home
          {
             if (lastkeysel == null)
             {
                event.returnValue=true;
             }
             else
             {
                 event.returnValue=false;
                 SelectMsg(0,true);
                 lastkeysel = document.getElementById("itemId_"+0);
             };
          }
           else if (window.event.keyCode == 35)///End
          {
             if (lastkeysel == null)
             {
                event.returnValue=true;
             }
             else
             {
                 event.returnValue=false;
                 g_itemcount = external.GetCount();
                 SelectMsg(g_itemcount-1,true);
                 lastkeysel = document.getElementById("itemId_"+(g_itemcount-1));
             };
          }
          else
          {
             event.returnValue=true;
          }
        }
    </script>

<script>
function OnMoveOle(obj)
{
 external.OnMouseMoveOle(event.screenX,event.screenY,obj);
}
function OnMoveDownOle(obj)
{
external.OnMouseDownOle(event.screenX,event.screenY,obj);
}
function OnMoveUpOle(obj)
{
external.OnMouseUpOle(event.screenX,event.screenY,obj);
}
</script>
</body>
</html>
